1. Field of the Invention
Embodiments of the present invention generally relate to computer graphics, and more particularly to sampling texture map data.
2. Description of the Related Art
Conventional graphics processors are exemplified by systems and methods developed to read and filter texture map samples. To simplify the texture map filtering performed within a graphics processor, a texture is prefiltered and various resolutions forming an image pyramid or “mipmap” are stored. FIG. 1A is a conceptual diagram of prior art showing the levels of a mipmapped texture including the finest level, level 101, and successively lower resolution levels, 102, 103, and 104.
The region in texture space corresponding to a pixel is called the pixel's “footprint”. A pixel can be approximated with a circle in screen space. For texture mapping of 2-dimensional textures, the corresponding footprint in texture space can be approximated by an ellipse. In classic use of mipmaps, a mipmap level is chosen so that the footprint when scaled to that level is about 1 texel (texture pixel) in diameter. Then a bilinear filter is used to interpolate between the values of four texels forming a 2×2 square around the footprint center. This is called isotropic filtering, because it filters equally in the two texture space dimensions u and v. Although the filter yielding excellent image quality, the ideal filter, has an approximately elliptical shape, isotropic filtering approximates the ellipse with a circle, to simplify the texture sampling and filtering computations.
In FIG. 1A, a footprint 115 is a pixel footprint in texture space, with a position 135 being the footprint center. FIG. 1B illustrates a prior art application of texture level 101 applied to pixels of a surface 140 that is receding in image space. When viewed in image space, footprint 115 (an ellipse) appears as circle 116. All ellipses have a largest diameter, called the major axis, and a smallest diameter, called the minor axis. Isotropic filtering yields high quality images for pixels whose footprints have major and minor texture axes that are similar in length. But texture stretching, oblique viewing, and perspective can cause footprints to be very elongated, such as footprint 115. When isotropic filtering is used in such situations, a circle is not a good approximation of an ellipse. If the circle is too small (diameter close to the minor axis), the filter is too sharp, too few texels are averaged, and aliasing results. If the circle is too large (diameter close to the major axis), the filter is too broad, too many texels are averaged, and blurring results. Anisotropic texture filtering addresses this problem by using a filter that more closely matches the elliptical shape of the ideal filter.
FIG. 1C illustrates footprint 115 including a minor axis 125 that is significantly shorter than a major axis 130. Texture samples along major axis 130, the axis of anisotropy, are read from one or more mipmap levels and are blended to produce a pixel color. The level from which the samples are read is determined using a level of detail (LOD) value which is nominally the log base 2 of the length of minor axis 125. The number of texture samples read from the texture map is determined based on the ratio of the major axis to the minor axis, with more texture samples needed as the ratio increases, i.e. as the ellipse becomes more elongated.
FIG. 1D illustrates five isotropic taps 140 that are positioned along major axis 130 to approximate an elliptical footprint, such as footprint 115. Each isotropic tap 140 corresponds to an isotropically filtered texture sample that is computed using conventional bilinear or trilinear isotropic filtering. Isotropic taps 140 are filtered to produce an anisotropically filtered texture sample corresponding to pixel 116. Isotropic taps 140 oftentimes extend beyond major axis 130, and therefore include texture samples which lie outside of the elliptical footprint, possibly resulting in visual artifacts such as blurring. The number of samples, spacing of the samples, and LOD should be determined such that the isotropic taps lie within the elliptical footprint.
FIG. 1E illustrates three isotropic taps 150 that are positioned along major axis 130 to approximate an elliptical footprint, such as footprint 115. In order to improve anisotropic texture mapping performance, the number of samples taken along major axis 130, the axis of anisotropy, is reduced from five to three, effectively decreasing the length of major axis 130. Unlike isometric taps 140, isotropic taps 150 do not cover major axis 130, and therefore texture samples which lie within the elliptical footprint are not filtered, possibly resulting in visual artifacts such as aliasing. Although performance is improved, the visual artifacts that may be introduced may cause decreased image quality. The number of samples, spacing of the samples, and LOD should be determined such that the isotropic taps cover the elliptical footprint.
Accordingly, there is a need to balance the performance of anisotropic texture mapping with image quality when performing anisotropic texture mapping.